// Extends reach-ui menu button base stylesheet
/* Used to detect in JavaScript if apps have loaded styles or not. */
:root {
  --reach-menu-button: 1;
}

reach-portal {
  [data-reach-menu] {
    [data-reach-menu-items] {
      &:focus-visible {
        background-color: var(--color-header-background);
      }

      [data-reach-menu-item][data-selected] {
        .menu__link {
          color: var(--color-primary-contrast);
        }
        .icon {
          stroke: var(--color-primary-contrast);
        }
      }
    }
  }
}

[data-reach-menu] {
  display: block;
  position: absolute;
  z-index: 2;
  font-size: var(--font-body);
  max-width: calc(100% - var(--height-button) - var(--spacing-xs));
}

[data-reach-menu-list] {
  display: block;
  white-space: nowrap;
  outline: none;
  background-color: rgba(var(--color-header-button-base), 0.9) !important;
  border-top: none;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);

  &:focus-visible {
    background-color: var(--color-brand) !important;
    outline: unset !important;
  }
}

[data-reach-menu-item] {
  display: block;
  z-index: 2;

  &:focus-visible {
    box-shadow: none;
  }
}

[data-reach-menu-item] {
  cursor: pointer;
  display: block;
  color: inherit;
  font: inherit;
  text-decoration: initial;
  border-radius: var(--border-radius);

  -webkit-user-select: none;
  user-select: none;
}

[data-reach-menu-item][data-selected] {
  background-color: var(--color-menu-background--active);
  box-shadow: none;

  .icon {
    stroke: var(--color-primary-contrast) !important;
  }

  .comment__menu-help {
    color: var(--color-primary-contrast);
  }
}

.menu__button {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;

  .icon {
    stroke: var(--color-text);
  }

  &:hover {
    opacity: 1;

    .icon {
      stroke: var(--color-link);
    }
  }
}

.menu__title {
  &[aria-expanded='true'] {
    transform: rotate(0deg);
  }
}

.menu__list {
  font-size: var(--font-small);
  animation: menu-animate-in var(--animation-duration) var(--animation-style);
  transform-origin: top;
  border-radius: var(--border-radius);
  padding: var(--spacing-xs) 0;

  [data-reach-menu-item] {
    margin: 0 var(--spacing-xxs);
  }
}

.menu__list--header {
  @extend .menu__list;

  [data-reach-menu-item][data-selected] {
    background-color: var(--color-menu-background--active);
    box-shadow: none;

    .icon {
      stroke: var(--color-brand-contrast);
    }

    .comment__menu-help {
      color: var(--color-brand-contrast);
    }
  }

  margin-top: 10px;
}

.menu__list--comments {
  @extend .menu__list;
}

.menu__link {
  display: flex;
  align-items: center;
  padding: var(--spacing-s);
  padding-right: var(--spacing-l);
  height: var(--button-height);

  .icon {
    stroke: var(--color-menu-icon);
    margin-right: var(--spacing-s);
  }

  .badge {
    margin-left: var(--spacing-s);
  }

  &:hover {
    color: var(--color-primary-contrast);
    .icon {
      stroke: var(--color-primary-contrast);
      margin-right: var(--spacing-s);
    }
  }
}

.menu__link-help {
  @extend .menu__link;
  display: block;
  color: var(--color-text);
  font-size: var(--font-small);
  padding-top: 0;
  white-space: normal;
  text-overflow: ellipsis;
  overflow-x: hidden;

  :hover > & {
    color: black;
    color: var(--color-text-help);
  }
}

.menu__link--notification {
  width: 100%;
  display: flex;
  align-items: flex-start;

  .icon__wrapper {
    height: 2.5rem;
    width: 2.5rem;
  }

  &:hover {
    cursor: pointer;
  }
}

.menu__link--notification-nolink {
  @extend .menu__link--notification;

  &:hover {
    cursor: default;
  }
}

.menu__link--all-notifications {
  @extend .button--alt;
  width: auto;
  align-self: flex-start;
  margin-right: auto;
  font-weight: var(--font-weight-bold);
  margin-top: var(--spacing-m);
}

.menu__separator {
  margin-top: var(--border-radius);
  margin-bottom: var(--border-radius);
}
